<?php
class EditVersionForm extends Zend_Form
{
	public function init()
	{
		
		$fronController = Zend_Controller_Front::getInstance();
		$request = $fronController->getRequest();
		$vid = $request->getParam('vid');
		
		$id = $this->createElement('hidden','id');
		$id->setValue($vid)
				->setDecorators(array(
							'viewHelper',
							'Errors',
							array('Description', array('tag'=>'', 'escape'=>false)),
							array(array('data'=>'HtmlTag'),
								array('tag'=>'td', 'valign'=>'top','colspan'=>2,'style'=>'background-color:#ffffff')),
							//array('Label', array('tag'=>'td')),
							array(array('row'=>'HtmlTag'), array('tag'=>'tr'))
				));
		
		$vname = $this->createElement('text','vname');
		$vname->setLabel('* Version Name:')
				->setRequired(true)
				->setAttrib('style','width:35%');
		
		
		$description = $this->createElement('text','description');
		$description->setLabel('Description:')
					->setAttrib('style','width:60%');
		
		$releasedate = $this->createElement('text','releasedate');
		$releasedate->setLabel('Release Date:')
				->setAttrib('style','width:35%');
		
		$update = $this->createElement('submit','update');
		$update->setLabel('Update')
				->setDecorators(array(
							'viewHelper',
								'Errors',
								array('Description', array('tag'=>'', 'escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td', 'valign'=>'top', 'style'=> 'background-color:#ffffff;text-align:center','openOnly'=>true,'colspan'=>2,'align'=>'center')),
								//array('Label', array('tag'=>'td')),
								array(array('row'=>'HtmlTag'), array('tag'=>'tr','openOnly'=>true))
				));
				
		$cancel = $this->createElement('button','cancel');
		$cancel->setLabel('Cancel')
				->setDecorators(array(
							'viewHelper',
								'Errors',
								array('Description', array('tag'=>'', 'escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td', 'valign'=>'top', 'style'=> 'background-color:#ffffff;','closeOnly'=>true)),
								//array('Label', array('tag'=>'td')),
								array(array('row'=>'HtmlTag'), array('tag'=>'tr','closeOnly'=>true))
				));
		
				
		$this->addElements(array(
						$vname,
						$description,
						$releasedate,
						$id,
						$update,
						$cancel
		));
		
		$this->setElementDecorators(array(
								'viewHelper',
								'Errors',
								array('Description', array('tag'=>'', 'escape'=>false)),
								array(array('data'=>'HtmlTag'),
									array('tag'=>'td', 'valign'=>'top', 'style'=> 'background-color:#ffffff;text-align:left')),
								array('Label', array('tag'=>'td')),
								array(array('row'=>'HtmlTag'), array('tag'=>'tr'))),
								array('vname', 'description','releasedate')
								);
								
		$this->addDecorators(array(
				'FormElements',
				array('HtmlTag', array('tag' => 'table','width'=>'100%','cellspacing'=>'0','border'=>'0','class'=>'pform')),
				'Form'
		));
	}
}